<template>
  <div class="sellContent">
    <div class="main">
      <ul class="nav border-1px">
        <li
          v-for="(item,index) in navList"
          :key="index"
          :class="menuIndex == index ? 'menuIndex': ''"
          @click='menuShow(index)'
        >
          {{item}}</li>
      </ul>
      <div v-show='menuIndex == 0'>
       <sellGoods :seller="seller"></sellGoods>
      </div>
      <div v-show='menuIndex == 1'>
       <sellRatings></sellRatings>
      </div>
      <div v-show='menuIndex == 2'>
       <sellSeller></sellSeller>
      </div>
    </div>
  </div>
</template>

<script>
import sellGoods from "./components/sellGoods/index";
import sellRatings from "./components/sellRatings/index";
import sellSeller from "./components/sellSeller/index";


export default {
  name: "sellContent",
  data() {
    return {
      menuIndex: 0,
      navList: ["商品", "评论", "商家"]
    };
  },
   created(){
    this.axios.get('/api/seller').then(function(res) {
      var data=(res.data.data)
        console.log('res', res);
        console.log('data', data);
        if(res.errno === 0) {
          this.seller = data;
          console.log('seller:', seller);
        }
    })
  },
  methods: {
    menuShow(index) {
      this.menuIndex = index;
      console.log(this.menuIndex);
    }
  },

  components: {
    sellGoods,
    sellRatings,
    sellSeller
  }
};
</script>



<style lang="scss" scoped>
@import "../../common/scss/index.scss";
.sellContent {
  width: 100%;
  height: 100%;
  .nav {
    width: 100%;
    display: flex;
    height: 80px;
    line-height: 80px;
    @include border-1px(#eee);
    li {
      flex: 1;
      align-items: center;
      text-align: center;
      
      a {
        font-size: 28px;
        color:rgb(77, 85, 93);
      }
      
    }
      .menuIndex{
        color: red;
      }
  }
}
</style>
